<html>
<head>
	<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
</head>
<body>
	<div id='app'>
		<p> 
			我所在的城市： <input v-model='city' />
		</p>
		<p> 
			我所在的街道： <input v-model='district' />
		</p>
		<p> 我所在的详细一些的地址：	<input v-model='full_address' /> </p>

	</div>
	<script>
		var app = new Vue({
			el: '#app',
			data: {
				city: '北京市',
				district: '朝阳区',
			},
			computed: {
				full_address: {
					get: function(){
						return this.city + "-" + this.district;
					},
					set: function(new_value){
						this.city = new_value.split('-')[0]
						this.district = new_value.split('-')[1]
					}
				}
			}
		})
	</script>
</body>
</html>

